package com.xueyi.system.harvestManager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyi.common.core.constant.basic.SqlConstants;
import com.xueyi.system.harvestManager.domain.po.HarvestManagerPo;
import com.xueyi.system.harvestManager.domain.query.HarvestManagerQuery;
import com.xueyi.system.harvestManager.domain.dto.HarvestManagerDto;
import com.xueyi.system.harvestManager.mapper.HarvestManagerMapper;
import com.xueyi.system.harvestManager.service.IHarvestManagerService;
import com.xueyi.system.harvestManager.manager.IHarvestManagerManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 采收管理管理 服务层处理
 *
 * @author zlf
 */
@Service
public class HarvestManagerServiceImpl extends BaseServiceImpl<HarvestManagerQuery, HarvestManagerDto, IHarvestManagerManager> implements IHarvestManagerService {


    @Autowired
    private HarvestManagerMapper harvestManagerMapper;
    /**
     * 查询采收管理对象列表 | 数据权限 | 附加数据
     *
     * @param harvestManager 采收管理对象
     * @return 采收管理对象集合
     */
    @Override
    //@DataScope(userAlias = "createBy", mapperScope = {"HarvestManagerMapper"})
    public List<HarvestManagerDto> selectListScope(HarvestManagerQuery harvestManager) {
        return baseManager.selectListExtra(harvestManager);
    }

    @Override
    public HarvestManagerPo getInfo(String productId) {

        QueryWrapper<HarvestManagerPo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("product_id",productId);
        queryWrapper.last(SqlConstants.LIMIT_ONE);
        HarvestManagerPo harvestManagerPo = harvestManagerMapper.selectOne(queryWrapper);
        return harvestManagerPo;
    }
}
